import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    redirect: '/home',
    // alias: '/',
    component: Layout,
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/home/index.vue')
      },
      {
        path: '/user-info',
        name: 'userInfo',
        component: () => import('../views/user/userInfo.vue')
      },
      {
        path: '/user-avatar',
        name: 'userAvatar',
        component: () => import('../views/user/userAvatar.vue')
      },
      {
        path: '/user-pwd',
        name: 'userPwd',
        component: () => import('../views/user/userPwd.vue')
      },
      {
        path: '/art-cate',
        name: 'artCate',
        component: () => import('../views/artCate/index.vue')
      },
      {
        path: '/art-list',
        name: 'artList',
        component: () => import('../views/artList/index.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    alias: '/',
    meta: { needToken: true },
    component: () => import('../views/login/index.vue')
  },
  {
    path: '/reg',
    name: 'reg',
    meta: { needToken: true },
    component: () => import('../views/login/register.vue')
  },

  // {
  //   path: "/about",
  //   name: "about",
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  // }
]

const router = new VueRouter({
  routes
})

export default router
